package com.konne.nightmare.FastPublicOpinion.mvp.model.impl;


import com.konne.nightmare.FastPublicOpinion.base.OnLoadDataListener;
import com.konne.nightmare.FastPublicOpinion.bean.OpinionDetailDataBean;
import com.konne.nightmare.FastPublicOpinion.http.BaseObserver;
import com.konne.nightmare.FastPublicOpinion.http.BaseResponse;
import com.konne.nightmare.FastPublicOpinion.http.RetrofitFactory;
import com.konne.nightmare.FastPublicOpinion.mvp.model.IHomeDetailModel;


public class HomeDetilModelImpl implements IHomeDetailModel {

    @Override
    public void responseOpinionDetail(int id, OnLoadDataListener<OpinionDetailDataBean.ResponseDataBean> onLoadDataListener) {
        RetrofitFactory.getSpecialInstance("id", String.valueOf(id)).getOpinionDetail(id, new BaseObserver<OpinionDetailDataBean.ResponseDataBean>() {
            @Override
            protected void onSuccess(BaseResponse<OpinionDetailDataBean.ResponseDataBean> t) throws Exception {
                onLoadDataListener.onSuccess(t);
            }

            @Override
            protected void onFailure(String error, boolean isNetWorkError) throws Exception {
                onLoadDataListener.onFailure(error);
            }
        });
    }

    @Override
    public void postOpinionAddCollect(String requestBody, OnLoadDataListener<String> onLoadDataListener) {
        RetrofitFactory.getInstance().postOpinionAddCollect(requestBody, new BaseObserver<String>() {
            @Override
            protected void onSuccess(BaseResponse<String> t) throws Exception {
                onLoadDataListener.onSuccess(t);
            }

            @Override
            protected void onFailure(String error, boolean isNetWorkError) throws Exception {
                onLoadDataListener.onFailure(error);
            }
        });
    }

    @Override
    public void postOpinionCancelCollect(String requestBody, OnLoadDataListener<String> onLoadDataListener) {
        RetrofitFactory.getInstance().postOpinionCancelCollect(requestBody, new BaseObserver<String>() {
            @Override
            protected void onSuccess(BaseResponse<String> t) throws Exception {
                onLoadDataListener.onSuccess(t);
            }

            @Override
            protected void onFailure(String error, boolean isNetWorkError) throws Exception {
                onLoadDataListener.onFailure(error);
            }
        });
    }

    @Override
    public void postOpinionAddWarning(String requestBody, OnLoadDataListener<String> onLoadDataListener) {
        RetrofitFactory.getInstance().postOpinionAddWarning(requestBody, new BaseObserver<String>() {
            @Override
            protected void onSuccess(BaseResponse<String> t) throws Exception {
                onLoadDataListener.onSuccess(t);
            }

            @Override
            protected void onFailure(String error, boolean isNetWorkError) throws Exception {
                onLoadDataListener.onFailure(error);
            }
        });
    }

    @Override
    public void postOpinionCancelWarning(String requestBody, OnLoadDataListener<String> onLoadDataListener) {
        RetrofitFactory.getInstance().postOpinionCancelWarning(requestBody, new BaseObserver<String>() {
            @Override
            protected void onSuccess(BaseResponse<String> t) throws Exception {
                onLoadDataListener.onSuccess(t);
            }

            @Override
            protected void onFailure(String error, boolean isNetWorkError) throws Exception {
                onLoadDataListener.onFailure(error);
            }
        });
    }

    @Override
    public void postOpinionAddBriefing(String requestBody, OnLoadDataListener<String> onLoadDataListener) {
        RetrofitFactory.getInstance().postOpinionAddBriefing(requestBody, new BaseObserver<String>() {
            @Override
            protected void onSuccess(BaseResponse<String> t) throws Exception {
                onLoadDataListener.onSuccess(t);
            }

            @Override
            protected void onFailure(String error, boolean isNetWorkError) throws Exception {
                onLoadDataListener.onFailure(error);
            }
        });
    }

    @Override
    public void postOpinionCancelBriefing(String requestBody, OnLoadDataListener<String> onLoadDataListener) {
        RetrofitFactory.getInstance().postOpinionCancelBriefing(requestBody, new BaseObserver<String>() {
            @Override
            protected void onSuccess(BaseResponse<String> t) throws Exception {
                onLoadDataListener.onSuccess(t);
            }

            @Override
            protected void onFailure(String error, boolean isNetWorkError) throws Exception {
                onLoadDataListener.onFailure(error);
            }
        });
    }

    @Override
    public void postOpinionDelete(String requestBody, OnLoadDataListener<String> onLoadDataListener) {
        RetrofitFactory.getInstance().postOpinionDelete(requestBody, new BaseObserver<String>() {
            @Override
            protected void onSuccess(BaseResponse<String> t) throws Exception {
                onLoadDataListener.onSuccess(t);
            }

            @Override
            protected void onFailure(String error, boolean isNetWorkError) throws Exception {
                onLoadDataListener.onFailure(error);
            }
        });
    }
}
